home *** CD-ROM | disk | FTP | other *** search
- /* GetRefNumFromRLI.c */
- /*
- * GetRefNumFromRLI.c
- * Copyright © 1992-93 Apple Computer Inc. All Rights Reserved.
- */
- #include "DTSSampleCSAM.h"
-
- OSErr
- GetRefNumFromRLI(
- register DTSSampleCSAMInfoPtr infoPtr,
- PackedRLI *packedRLI,
- short *refNum
- )
- {
- OSErr status;
- RLI rli;
- CatalogInfoPtr catalogInfoPtr;
-
- status = kOCENoSuchDNode;
- OCEUnpackRLI(packedRLI, &rli);
- if ((rli.path == NULL
- || rli.path->dataLength == 0)
- && (rli.dNodeNumber == kNULLDNodeNumber
- || rli.dNodeNumber == kRootDNodeNumber)) {
- /*
- * Walk through the linked list of active (i.e., known) directories
- * to find one that matches the rli. Return noErr if we find one.
- */
- for (catalogInfoPtr = (CatalogInfoPtr) INFO.catalogQHdr.qHead;
- catalogInfoPtr != NULL;
- catalogInfoPtr = (CatalogInfoPtr) catalogInfoPtr->qLink) {
- if (OCEEqualRString(
- (RString *) rli.directoryName,
- (RString *) &catalogInfoPtr->directoryName,
- kOCEDirName)
- && OCEEqualDirDiscriminator(
- &rli.discriminator,
- &catalogInfoPtr->discriminator)) {
- status = noErr;
- *refNum = catalogInfoPtr->refNum;
- break;
- }
- }
- if (status != noErr) {
- LogStatus('GRLI', status, "\pNo match to any directory");
- LogRString('GRLI', rli.directoryName);
- }
- }
- LogStatus('PCmd', status, "\pGetRefNumFromRLI");
- return (status);
- }
-